<template>
    <view>
        <view class="contentSearch">
            <u-search disabled @click="go" placeholder="搜索" :showAction="false" v-model="keyword"></u-search>
            <view @click="goMessage" class="message fcc">
                <!--               <u-icon size="28" name="bell"></u-icon>-->
                <img class="mess" src="@/static/images/home/mess.jpg">

                消息

                <view class="num">
                    <u-badge bgColor="#0044B7" max="99" :value="newnum"></u-badge>
                </view>
            </view>
            <view @click="goClassify" class="fcc box">
                <img class="logoName" src="@/static/images/home/all.jpg">
                <!--               <u-icon name="photo" size="28"></u-icon>-->
                分类
            </view>
        </view>
        <scroll-view scroll-x="true" @scroll="scrollA" scroll-left="120">
            <view class="scroll-view" >
                <u-tag bgColor="#F3F3F3" @click="goserch(item)" color="#5f5f5f" border-color="#F3F3F3" v-for="(item,i) in tagList" :key="i"
                       :text="item" type="warning" shape="circle"></u-tag>
            </view>
        </scroll-view>

    </view>

</template>
<script>
export default {
    name: 'index',
    components: {},
    props: {
        keyword: {
            type: String,
            default: ''
        },
		newnum:{
			type:Number
		},
		tagList:{
			type:Array
		}
    },
    data() {
        return {
            scrollTop: 0,
            old: {
                scrollTop: 0
            },
            // num: 3,
            // tagList: [
            //     '神舟笔记本', '石英砂成品', '原石成品', '神舟笔记本', '石英砂成品', '原石成品',
            // ]
        }
    },
    methods: {
		goserch(item){
			this.$.open('/pages/index/searchList?keyword='+item)
		},
        go() {
            uni.navigateTo({url: '/pages/index/search'})
        },
        scrollA(e) {
            console.log(e)
            this.old.scrollTop = e.detail.scrollTop
        },
        goMessage() {
            uni.navigateTo({url: '/pages/message/index'})
        },
        goClassify() {
            uni.navigateTo({url: '/pages/index/classify'})

        }
    },
    created() {

    },
    mounted() {

    },
}
</script>
<style lang="scss" scoped>
.contentSearch {
  gap: 20rpx;
  display: flex;
  align-items: center;
  font-size: 22rpx;

  .logoName {
    width: 68rpx;
    height: 36rpx;
    //width: 100%;
    //hei ght: 28px;
  }

  .mess {
    height: 36rpx;
    width: 36rpx;


  }

  .message {
    position: relative;
    flex-direction: column;

    .num {
      position: absolute;
      top: -10rpx;
      right: -10rpx;

    }

  }

  .box {
    flex-direction: column;
    justify-content: space-between;
    height: 100%;

  }
}

.scroll-view {
  display: flex;
  gap: 10rpx;
  padding-top: 20rpx;
}
</style>

